﻿<mpc:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phoneNavigation="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:vm="clr-namespace:VanGuideWP7.ViewModel"
    xmlns:uc="clr-namespace:VanGuideWP7.Controls"
    xmlns:mpc="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:my="clr-namespace:RedBit.WindowsPhone.Controls;assembly=RedBit.WindowsPhone.Controls"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:VanGuideWP7="clr-namespace:VanGuideWP7"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    x:Class="VanGuideWP7.View.DetailsPage"
    mc:Ignorable="d"
    d:DesignWidth="480"
    d:DesignHeight="800">

    <mpc:PhoneApplicationPage.FontFamily>
        <StaticResource ResourceKey="PhoneFontFamilyNormal"/>
    </mpc:PhoneApplicationPage.FontFamily>
    <mpc:PhoneApplicationPage.FontSize>
        <StaticResource ResourceKey="PhoneFontSizeNormal"/>
    </mpc:PhoneApplicationPage.FontSize>
    <mpc:PhoneApplicationPage.Foreground>
        <StaticResource ResourceKey="PhoneForegroundBrush"/>
    </mpc:PhoneApplicationPage.Foreground>
    <mpc:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/AddTag.png" Text="Add Tag"  x:Name="abibTag" Click="abibTag_Click" />
            <shell:ApplicationBarIconButton IconUri="/Images/AddComment.png" Text="Add Comment"  x:Name="abibComment" Click="abibComment_Click" />
        </shell:ApplicationBar>
    </mpc:PhoneApplicationPage.ApplicationBar>

    <Grid x:Name="LayoutRoot"
          Background="{StaticResource PhoneBackgroundBrush}" >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <!--ContentGrid is empty. Place new content here-->
        <Grid x:Name="ContentGrid"
              Grid.Row="0">
            <controls:Pivot Title="{Binding Pin.Description}">
                <controls:PivotItem  Header="comments" >
                    <ListBox ItemsSource="{Binding Pin.Comments}" >
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid x:Name="LayoutRoot">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="43" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <Image Grid.Column="0"
                                   Source="{Binding PicUrl}"
                                   Width="43"
                                   Height="43"
                                   VerticalAlignment="Top" />
                                    <StackPanel Grid.Column="1"
                                        Margin="12,0,0,0"
                                        VerticalAlignment="Center">
                                        <TextBlock x:Name="ItemText"
                                           Text="{Binding Author}"
                                           Style="{StaticResource PhoneTextExtraLargeStyle}"
                                           HorizontalAlignment="Left"
                                           Margin="-3,-13,0,0" />
                                        <TextBlock x:Name="DetailsText"
                                           Text="{Binding Text}"
                                           Style="{StaticResource PhoneTextSubtleStyle}"
                                           HorizontalAlignment="Left"
                                           Margin="-1,-6,0,0" />
                                    </StackPanel>
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </controls:PivotItem>
                <controls:PivotItem Header="ratings" >
                    <Grid Margin="0,0,8,8">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <uc:RatingsControl x:Name="StarRatings" Grid.Row="0" HorizontalAlignment="Center"
                                           Rating="{Binding Pin.Rating}" RatingSelected="StarRatings_RatingSelected" />
                        <TextBlock x:Name="tbRatings" 
                                   Text="{Binding Pin.RatingText}" Grid.Row="1" HorizontalAlignment="Center"/>
                    </Grid>
                </controls:PivotItem>
                <controls:PivotItem Header="tags" >
                    <ListBox ItemsSource="{Binding Pin.Tags}">
                        <DataTemplate>
                            <TextBlock Text="{Binding}" />
                        </DataTemplate>
                    </ListBox>
                </controls:PivotItem>
            </controls:Pivot>

            <VanGuideWP7:LoadingBar Visibility="{Binding LoadingVisibility}" 
                                    HorizontalAlignment="Left" 
                                    VerticalAlignment="Top" 
                                    LoadingText="{Binding LoadingText}" 
                                    EnableAnimation="{Binding Loading}"/>

        </Grid>
    </Grid>
</mpc:PhoneApplicationPage>
